(load "ex1-24.scm")
; Actually I did this in ex1-24...
(define (fast-expt base exp)
    (cond   ((= exp 0) 1)
            ((even? exp)
                (square (fast-expt base (/ exp 2))))
            (else
                (* base (fast-expt base (- exp 1))))))

(define (expmod base exp m)
    (remainder (fast-expt base exp) m))

(display "\n========================================\n")
(search-for-primes EX1-14-TEST-NUM)
(display "\n========================================\n")

; 可见，先把幂算出来再求模会很慢，当数大的时候甚至会出错。
; 这是因为一个大数的幂会非常大；而先求模的方式则让数字限制在模的范围内，所以不会溢出也会比较快。